package com.imay.live.activity.family.helper.session.extension;

import com.alibaba.fastjson.JSONObject;
import com.imay.live.helper.UrlHelper;

/**
 * Created by nick on 2017/9/14.
 * 自定义消息_动态
 */

public class LiveAttachment extends CustomAttachment {

    private final String KEY_HORIZONTAL = "horizontal";
    private final String KEY_IMGFACE = "imgFace";
    private final String KEY_NICK = "nick";
    private final String KEY_OPENLIVETYPE = "openLiveType";
    private final String KEY_ROOM_ID = "room_id";
    private final String KEY_TITLE = "title";
    private final String KEY_UID = "uid";
    private final String KEY_URL = "url";

    private int horizontal;
    private String imgFace;
    private String nick;
    private int openLiveType;
    private long room_id;
    private String title;
    private long uid;
    private String url;

    LiveAttachment() {
        super(CustomAttachmentType.dynamics);
    }

    @Override
    protected void parseData(JSONObject data) {
        horizontal = data.getInteger(KEY_HORIZONTAL);
        imgFace = data.getString(KEY_IMGFACE);
        nick = data.getString(KEY_NICK);
        openLiveType = data.getInteger(KEY_OPENLIVETYPE);
        room_id = data.getLong(KEY_ROOM_ID);
        title = data.getString(KEY_TITLE);
        uid = data.getLong(KEY_UID);
        url = data.getString(KEY_URL);
    }

    @Override
    protected JSONObject packData() {
        JSONObject data = new JSONObject();
        data.put(KEY_HORIZONTAL, horizontal);
        data.put(KEY_IMGFACE, imgFace);
        data.put(KEY_NICK, nick);
        data.put(KEY_OPENLIVETYPE, openLiveType);
        data.put(KEY_ROOM_ID, room_id);
        data.put(KEY_TITLE, title);
        data.put(KEY_UID, uid);
        data.put(KEY_URL, url);
        return data;
    }

    public int getHorizontal() {
        return horizontal;
    }

    public String getImgFace() {
        return imgFace;
    }

    public String getNick() {
        return nick;
    }

    public int getOpenLiveType() {
        return openLiveType;
    }

    public long getRoom_id() {
        return room_id;
    }

    public String getTitle() {
        return title;
    }

    public long getUid() {
        return uid;
    }

    public String getUrl() {
        return url;
    }
}
